﻿using HuiLian.Common.Input;
using HuiLian.Common.Output;
using HuiLian.Model.Platform;
using HuiLian.Service.HdlScada.HdlScadaAlarmHistory;
using HuiLian.Service.HdlScada.HdlScadaSensorInfo;
using HuiLian.Web.Controllers.Platform;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace HuiLian.Web.Controllers.HdlScada
{
    /// <summary>
    /// 传感器信息记录
    /// </summary>
    public class HdlScadaSensorInfoController : AreaController
    {
        private readonly IHdlScadaSensorInfoService _hdlScadaSensorInfoServices;

        public HdlScadaSensorInfoController(IHdlScadaSensorInfoService hdlScadaSensorInfoServices)
        {
            _hdlScadaSensorInfoServices = hdlScadaSensorInfoServices;
        }

        /// <summary>
        /// 查询单条传感器信息记录
        /// </summary>
        /// <param name="sensor_code">传感器编码</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> Get(string sensor_code)
        {
            return await _hdlScadaSensorInfoServices.GetAsync(sensor_code);
        }

        /// <summary>
        /// 查询分页传感器信息记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<HdlScadaSensorInfoEntity> model)
        {
            return await _hdlScadaSensorInfoServices.PageAsync(model);
        }

        /// <summary>
        /// 通过站点名称模糊查询站点名称列表
        /// </summary>
        /// <param name="station_name">站点名称</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> GetStationNameList(string station_name)
        {
            return await _hdlScadaSensorInfoServices.GetStationNameListAsync(station_name);
        }

        /// <summary>
        /// 通过传感器名称模糊查询传感器名称列表
        /// </summary>
        /// <param name="station_code">站点code</param>
        /// <param name="sensor_name">传感器名称</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> GetSensorNameListByStationCode(string station_code,string sensor_name)
        {
            return await _hdlScadaSensorInfoServices.GetSensorNameListByStationCodeAsync(station_code, sensor_name);
        }
    }
}
